<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
    <el-row class="header navbar bg-white shadow">
        <div class="btn-group tool-button mt5">
            <el-date-picker
                    v-model="searchDate"
                    type="datetimerange"
                    :picker-options="pickerOptions"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                    align="right"
                    size="medium"
                    :default-time="['00:00:00', '23:59:59']"
                    value-format="yyyy-MM-dd HH:mm:ss">
            </el-date-picker>
        </div>
        <!--按币种搜索-->
        <div class="btn-group tool-button mt5">
            <el-select v-model="pageForm.currencyId" placeholder="请选择币种"
                       size="medium"
            >
                <el-option
                        v-for="item in currencies"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id"
                >
                </el-option>
            </el-select>
        </div>
        <div class="btn-group tool-button mt5">
            <el-select v-model="pageForm.channel"
                       filterable
                       size="medium"
                       placeholder="请选择提现方式">
                <el-option v-for="item in channels"
                           :value="item[0]"
                           :label="item[1]">
                </el-option>
            </el-select>
        </div>
        <!--按状态搜索-->
        <div class="btn-group tool-button mt5">
            <el-select v-model="pageForm.status" placeholder="请选择状态"
                       size="medium"
            >
                <el-option
                        v-for="item in statusOptions"
                        :key="item.value"
                        :label="item.name"
                        :value="item.value"
                >
                </el-option>
            </el-select>
        </div>
        <div class="btn-group tool-button mt5">
            <el-input placeholder="用户名、手机号、单号" v-model="pageForm.searchKeyword"
                      @keyup.enter.native="doSearch" size="medium">
                <el-button slot="append" icon="el-icon-search" @click="doSearch"></el-button>
            </el-input>
        </div>
        <div class="pull-right offscreen-right mt5">
            <el-button size="medium" @click="openAdd">
                <i class="ti-plus"></i>
                提现
            </el-button>
        </div>
        <div class="btn-group tool-button mt5">
            <el-checkbox v-model="isInside">不统计内部账号</el-checkbox>
        </div>
    </el-row>

    <el-row class="el-table-container">
        <el-table
                :data="tableData"
                @sort-change='pageOrder'
                size="small"
                header-align="center"
                :summary-method="getSummaries"
                border
                show-summary
                style="width: 100%"
                @selection-change="handleSelectionChange"
                :default-sort="{prop: 'opAt', order: 'descending'}"
        >
            <el-table-column
                    label="单号"
                    header-align="center"
                    prop="no"
                    align="center"
                    :show-overflow-tooltip="true">
            </el-table-column>

            <el-table-column
                    label="第三方单号"
                    header-align="center"
                    prop="outNo"
                    align="center"
                    :show-overflow-tooltip="true">
                <template slot-scope="scope">
                    {{scope.row.outNo ? scope.row.outNo : '无' }}
                </template>
            </el-table-column>

            <el-table-column
                    label="用户昵称"
                    header-align="center"
                    prop="nickName"
                    align="center"
                    :show-overflow-tooltip="true">
            </el-table-column>

            <el-table-column
                    label="用户名"
                    header-align="center"
                    prop="userName"
                    align="center"
                    :show-overflow-tooltip="true">
            </el-table-column>

            <el-table-column
                    label="手机号"
                    header-align="center"
                    prop="phone"
                    align="center"
                    :show-overflow-tooltip="true">
            </el-table-column>

            <el-table-column
                    label="币种"
                    header-align="center"
                    prop="currencyName"
                    align="center"
                    :show-overflow-tooltip="true">
            </el-table-column>

            <el-table-column
                    label="金额"
                    header-align="center"
                    prop="amount"
                    align="center"
                    :show-overflow-tooltip="true">
            </el-table-column>

            <el-table-column
                    label="实际金额(扣手续费后)"
                    header-align="center"
                    prop="realAmount"
                    align="center"
                    :show-overflow-tooltip="true">
            </el-table-column>

            <el-table-column
                    label="方式"
                    header-align="center"
                    prop="channel"
                    align="center"
                    :show-overflow-tooltip="true">
                <template slot-scope="scope">
                    {{scope.row.channel ? formatChannel(scope.row.channel) : '无'}}
                </template>
            </el-table-column>

            <el-table-column
                    label="银行所属国家"
                    header-align="center"
                    :show-overflow-tooltip="true"
                    align="center">
                <template slot-scope="scope">
                    <span v-if="scope.row.type === 'UPI'">India</span>
                    <span v-else>{{scope.row.country}}</span>
                </template>
            </el-table-column>

            <el-table-column
                    label="银行"
                    header-align="center"
                    align="center"
                    :show-overflow-tooltip="true">
                <template slot-scope="scope">
                    <span v-if="scope.row.type === 'UPI'">UPI</span>
                    <span v-else>{{scope.row.bank}}</span>
                </template>
            </el-table-column>

            <el-table-column
                    label="银行卡号"
                    header-align="center"
                    prop="cardNumber"
                    align="center"
                    :show-overflow-tooltip="true">
            </el-table-column>

            <el-table-column
                    sortable
                    label="创建时间"
                    header-align="center"
                    align="center"
                    prop="opAt">
                <template slot-scope="scope">
                    {{formatAt(scope.row.ctAt)}}
                </template>
            </el-table-column>

            <el-table-column
                    sortable
                    label="状态"
                    header-align="center"
                    align="center"
                    prop="status">
                <template slot-scope="scope">
                    {{formatStatus(scope.row.status)}}
                </template>
            </el-table-column>

            <el-table-column
                    label="操作"
                    width="120">
                <template slot-scope="scope">
                    <el-button size="mini" type="primary" @click="openExamine(scope.row)"
                               v-if="scope.row.status == 'APPLYING'">审核
                    </el-button>
                    <el-button size="mini" type="primary" @click="openExamineReview(scope.row)"
                               v-else-if="scope.row.status == 'PENDING_BANK'">复审
                    </el-button>
                    <el-button size="mini" type="info" @click="openExamine(scope.row)"
                               v-else>详情
                    </el-button>
                </template>
            </el-table-column>
        </el-table>
    </el-row>
    <el-row class="el-pagination-container">
        <el-pagination
                @size-change="pageSizeChange"
                @current-change="pageNumberChange"
                :current-page="pageForm.pageNumber"
                :page-sizes="[10, 20, 30, 50]"
                :page-size="pageForm.pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="pageForm.totalCount">
        </el-pagination>
    </el-row>

    <el-dialog
            title="提现"
            :visible.sync="addDialogVisible"
            width="30%">
        <el-form :model="formData" ref="addForm" :rules="formRules" size="small" label-width="80px">
            <el-form-item prop="currencyId" label="币种">
                <el-select
                        v-model="formData.currencyId"
                        filterable
                        reserve-keyword
                        placeholder="选择币种"
                        style="width:300px"
                        @change="currencyChange"
                        :loading="loading">
                    <el-option
                            v-for="item in currencies"
                            :key="item.id"
                            :label="item.name"
                            :value="item.id"
                            :disabled="!item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item prop="toUser" label="用户">
                <el-select
                        v-model="formData.toUser"
                        filterable
                        remote
                        reserve-keyword
                        placeholder="按用户名精确搜索"
                        :remote-method="getAccounts"
                        :loading="loading"
                        style="width:300px"
                        @change="onChange">
                    <el-option
                            v-for="item in userOptions"
                            :key="item.userId"
                            :label="item.label"
                            :value="item.userId">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item prop="cardId" label="用户卡号" v-if="cardInputShow">
                <el-select
                        v-model="formData.cardId"
                        filterable
                        reserve-keyword
                        placeholder="系统扣款不需要选卡号"
                        style="width:300px"
                        :loading="loading">
                    <el-option
                            v-for="item in cards"
                            :key="item.id"
                            :label="item.cardNumber"
                            :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item prop="amount">
                <template slot="label">
                    <span style="position:relative">
                        <span>金额</span>
                        <el-tooltip style="position:absolute;" effect="light" placement="top"
                                    content="使用京都泰国代付,金额需高于100低于10000">
                            <i class="el-icon-question" class="tips-icon"></i>
                        </el-tooltip>
                    </span>
                </template>
                <el-input maxlength="100"
                          style="width:300px"
                          placeholder="金额"
                          v-model="formData.amount"
                          auto-complete="off" tabindex="2" type="text"></el-input>
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
                    <el-button @click="addDialogVisible = false">取 消</el-button>
                    <el-button type="primary" @click="doAdd">提 交</el-button>
                  </span>
    </el-dialog>
    <!-- 审核页面   -->
    <el-dialog
            :title="isExamine == true ? '审核' : '详情'"
            :visible.sync="examineDialogVisible"
            width="40%">
        <el-form :model="formData" ref="examineForm" size="small" label-width="150px">

            <el-form-item prop="currencyName" label="币种">
                <div class="el-input__inner">{{formData.currencyName + (formData.country ?'(' + formData.country +')' :
                    '')}}
                </div>
            </el-form-item>

            <el-form-item prop="status" label="状态">
                <div class="el-input__inner">{{formatStatus(formData.status)}}</div>
            </el-form-item>

            <el-form-item prop="status" label="支付方式">
                <div class="el-input__inner">{{formatChannel(formData.channel)}}</div>
            </el-form-item>

            <el-form-item prop="no" label="订单号">
                <div class="el-input__inner">{{formData.no}}</div>
            </el-form-item>

            <el-form-item prop="userName" label="用户名">
                <div class="el-input__inner">{{formData.userName}}</div>
            </el-form-item>

            <el-form-item prop="userName" label="手机号">
                <div class="el-input__inner">{{formData.phone}}</div>
            </el-form-item>

            <el-form-item v-if="formData.cardNumber" label="用户卡号">
                <div class="el-input__inner">{{formData.cardNumber}}</div>
            </el-form-item>

            <el-form-item v-if="formData.bank" label="关联银行">
                <div class="el-input__inner">{{formData.bank}}</div>
            </el-form-item>

            <el-form-item prop="code" label="金额">
                <div class="el-input__inner">{{formData.amount}}</div>
            </el-form-item>

            <el-form-item prop="ctAt" label="发起时间">
                <div class="el-input__inner">{{formatAt(formData.ctAt)}}</div>
            </el-form-item>

            <el-form-item v-if="formData.examineAt" label="审核时间">
                <div class="el-input__inner">{{formatAt(formData.examineAt)}}</div>
            </el-form-item>
            <el-form-item v-if="formData.opBy" label="操作人">
                <div class="el-input__inner">{{formData.opBy}}</div>
            </el-form-item>

            <el-form-item v-if="formData.cancelAt" label="取消时间">
                <div class="el-input__inner">{{formatAt(formData.cancelAt)}}</div>
            </el-form-item>

            <el-form-item label="备注">
                <el-input v-if="isExamine"
                          maxlength="100"
                          v-model="formData.remark"
                          type="text">
                </el-input>
                <div><span class="el-input__inner" v-if="!isExamine">{{formData.remark ? formData.remark : '无'}}</span>
                </div>
            </el-form-item>

            <el-form-item v-if="!isExamine" label="提现方式">
                <div class="el-input__inner">{{formData.channel ? formatChannel(formData.channel) : '无'}}</div>
            </el-form-item>

        </el-form>
        <span slot="footer" class="dialog-footer">
            <el-button v-if="formData.status == 'APPLYING'"
                       type="danger"
                       :disabled = 'buttonDisabled'
                       @click="doExamine({id:formData.id,sure:false,channel:'',opType:'EXAMINE'})">拒绝/取消</el-button>

            <el-button v-if="formData.status == 'APPLYING' && formData.channel != 'PLATFORM'"
                       type="primary"
                       :disabled = 'buttonDisabled'
                       @click="doExamine({id:formData.id,sure:true,channel:'BANK',opType:'EXAMINE'})">手动打款</el-button>

            <el-button v-if="formData.status == 'APPLYING' && withdrawalMethod.includes('XINDO_VND')"
                       type="primary"
                       :disabled = 'buttonDisabled'
                       @click="doExamine({id:formData.id,sure:true,channel:'XINDO_VND',opType:'EXAMINE'})">京都泰国代付</el-button>

            <el-button v-if="formData.status == 'APPLYING' && withdrawalMethod.includes('ELEPHANT168')"
                       type="primary"
                       :disabled = 'buttonDisabled'
                       @click="doExamine({id:formData.id,sure:true,channel:'ELEPHANT168',opType:'EXAMINE'})">大象支付代付</el-button>

            <el-button v-if="formData.status == 'APPLYING' && withdrawalMethod.includes('GLOBALPAY')"
                       type="primary"
                       :disabled = 'buttonDisabled'
                       @click="doExamine({id:formData.id,sure:true,channel:'GLOBALPAY',opType:'EXAMINE'})">GLOBALPAY代付</el-button>

            <el-button v-if="formData.status == 'APPLYING' && formData.channel == 'PLATFORM'"
                       type="primary"
                       :disabled = 'buttonDisabled'
                       @click="doExamine({id:formData.id,sure:true,channel:'PLATFORM',opType:'EXAMINE'})">系统扣款</el-button>
        </span>
    </el-dialog>


    <!-- 复审页面   -->
    <el-dialog
            :title="isExamineReview == true ? '复审' : '详情'"
            :visible.sync="examineReviewDialogVisible"
            width="40%">
        <el-form :model="formData" ref="examineForm" size="small" label-width="150px">

            <el-form-item prop="currencyName" label="币种">
                <div class="el-input__inner">{{formData.currencyName + (formData.country ?'(' + formData.country +')' :
                    '')}}
                </div>
            </el-form-item>

            <el-form-item prop="status" label="状态">
                <div class="el-input__inner">{{formatStatus(formData.status)}}</div>
            </el-form-item>

            <el-form-item prop="status" label="支付方式">
                <div class="el-input__inner">{{formatChannel(formData.channel)}}</div>
            </el-form-item>

            <el-form-item prop="no" label="订单号">
                <div class="el-input__inner">{{formData.no}}</div>
            </el-form-item>

            <el-form-item prop="userName" label="用户名">
                <div class="el-input__inner">{{formData.userName}}</div>
            </el-form-item>

            <el-form-item prop="userName" label="手机号">
                <div class="el-input__inner">{{formData.phone}}</div>
            </el-form-item>

            <el-form-item v-if="formData.cardNumber" label="用户卡号">
                <div class="el-input__inner">{{formData.cardNumber}}</div>
            </el-form-item>

            <el-form-item v-if="formData.bank" label="关联银行">
                <div class="el-input__inner">{{formData.bank}}</div>
            </el-form-item>

            <el-form-item prop="code" label="金额">
                <div class="el-input__inner">{{formData.amount}}</div>
            </el-form-item>

            <el-form-item prop="ctAt" label="发起时间">
                <div class="el-input__inner">{{formatAt(formData.ctAt)}}</div>
            </el-form-item>

            <el-form-item v-if="formData.examineAt" label="审核时间">
                <div class="el-input__inner">{{formatAt(formData.examineAt)}}</div>
            </el-form-item>
            <el-form-item v-if="formData.opBy" label="操作人">
                <div class="el-input__inner">{{formData.opBy}}</div>
            </el-form-item>

            <el-form-item v-if="formData.cancelAt" label="取消时间">
                <div class="el-input__inner">{{formatAt(formData.cancelAt)}}</div>
            </el-form-item>

            <el-form-item label="备注">
                <el-input v-if="isExamineReview"
                          maxlength="100"
                          v-model="formData.remark"
                          type="text">
                </el-input>
                <div><span class="el-input__inner"
                           v-if="!isExamineReview">{{formData.remark ? formData.remark : '无'}}</span>
                </div>
            </el-form-item>

            <el-form-item v-if="!isExamineReview" label="提现方式">
                <div class="el-input__inner">{{formData.channel ? formatChannel(formData.channel) : '无'}}</div>
            </el-form-item>

        </el-form>
        <span slot="footer" class="dialog-footer">
            <el-button v-if="formData.status == 'PENDING_BANK'"
                       type="danger"
                       :disabled = 'buttonDisabled'
                       @click="doExamine({id:formData.id,sure:false,channel:formData.channel,opType:'REVIEW'})">复审失败</el-button>

            <!-- 第三方回调失败，但是钱已到账，此时提现状态是PENDING_BANK，可以直接点通过让提现状态变成SUCCESS，并且不改变原来的提现channel -->
            <el-button v-if="formData.status == 'PENDING_BANK'"
                       type="primary"
                       :disabled = 'buttonDisabled'
                       @click="doExamine({id:formData.id,sure:true,channel:formData.channel,opType:'REVIEW'})">复审成功</el-button>
        </span>
    </el-dialog>

</div>
<script>
    function getParams(key) {
        var result = {};
        var paramStr = encodeURI(window.document.location.search);
        if (paramStr) {
            paramStr = paramStr.substring(1);
            var param4MapVerify = paramStr.split('&');
            for (var p = 0; p < param4MapVerify.length; p++) {
                result[param4MapVerify[p].split('=')[0]] = unescape(param4MapVerify[p].split('=')[1]);
            }
        }
        let resultElement = result[key];
        return resultElement === undefined ? "" : resultElement;
    }

    let vue = new Vue({
        el: "#app",
        data: function () {
            return {
                pickerOptions: {
                    disabledDate: function (time) {
                        return time.getTime() > new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000);
                    },
                    shortcuts: [{
                        text: '最近一周',
                        onClick: function (picker) {
                            var end = new Date();
                            var start = new Date();
                            var temp = moment().add(-1, 'weeks').valueOf();
                            start.setTime(temp);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近一个月',
                        onClick: function (picker) {
                            var end = new Date();
                            var start = new Date();
                            var temp = moment().add(-1, 'months').valueOf();
                            start.setTime(temp);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近三个月',
                        onClick: function (picker) {
                            var end = new Date();
                            var start = new Date();
                            var temp = moment().add(-3, 'months').valueOf();
                            start.setTime(temp);
                            picker.$emit('pick', [start, end]);
                        }
                    }]
                },
                addDialogVisible: false,
                isExamine: false,
                isExamineReview: false,
                examineDialogVisible: false,
                examineReviewDialogVisible: false,
                buttonDisabled: false,
                cardInputShow: true,
                selectData: [],
                searchDate: [],
                pageForm: {
                    searchName: "",
                    searchKeyword: getParams("no"),
                    searchDate: "",
                    pageNumber: 1,
                    pageSize: 10,
                    totalCount: 0,
                    pageOrderName: "opAt",
                    pageOrderBy: "descending",
                    conditionData: "",
                },
                tableData: [],
                // 提现方式集合
                withdrawalMethod: [],
                sum: 0,
                formData: {
                    id: "",
                    currency: {},
                    channel: '',
                    cardId: '',
                    toUser: ''
                },
                formRules: {
                    toUser: [
                        {required: true, message: '选择用户', trigger: 'blur'}
                    ],
                    amount: [
                        {required: true, message: '输入金额', trigger: 'blur'}
                    ],
                    currencyId: [
                        {required: true, message: '选择币种', trigger: 'blur'}
                    ]
                },
                userOptions: [],
                cards: [],
                currencies: [],
                statusOptions: [],
                loading: false,
                isInside: true,
                channels: new Map([['BANK', '手动'], ['XINDO_VND', '京都泰国'], ['ELEPHANT168', '大象支付'], ['GLOBALPAY', 'GLOBALPAY'], ['PLATFORM', '系统扣款']]),
            }
        },
        methods: {
            pageOrder: function (column) {//按字段排序
                this.pageForm.pageOrderName = column.prop;
                this.pageForm.pageOrderBy = column.order;
                this.pageData();
            },
            pageNumberChange: function (val) {//页码更新操作
                this.pageForm.pageNumber = val;
                this.pageData();
            },
            pageSizeChange: function (val) {//分页大小更新操作
                this.pageForm.pageSize = val;
                this.pageData();
            },
            doSearch: function () {
                this.pageForm.pageNumber = 1;
                this.pageData();
            },
            pageData: function () {//加载分页数据
                var self = this;
                sublime.showLoadingbar();//显示loading
                if (self.searchDate) {
                    self.pageForm.searchDate = self.searchDate.toString();
                } else {
                    self.pageForm.searchDate = "";
                }
                self.pageForm.conditionData = "";
                if (self.isInside) {
                    if (self.pageForm.conditionData === "") {
                        self.pageForm.conditionData = "isInside";
                    } else {
                        self.pageForm.conditionData = self.pageForm.conditionData + ",isInside";
                    }
                }
                $.post(base + "/platform/user/account/withdraw/data", self.pageForm, function (data) {
                    sublime.closeLoadingbar();//关闭loading
                    if (data.code == 0) {
                        self.tableData = data.data.pagination.list;
                        self.sum = data.data.sum;
                        self.pageForm.totalCount = data.data.pagination.totalCount;
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json");
            },
            getSummaries(param) {
                const {columns, data} = param;
                const sums = [];
                sums[5] = '合计USD';
                sums[6] = this.sum.allAmount;
                sums[7] = this.sum.allRealAmount;
                return sums;
            },
            // 格式化时间
            formatAt: function (val) {
                if (val > 0)
                    return moment(val * 1000).format("YYYY-MM-DD HH:mm");
                return "";
            },
            // 枚举值转中文
            formatStatus: function (val) {
                for (const item of this.statusOptions) {
                    if (item.value === val) {
                        return item.name;
                    }
                }
            },
            // 提现通道格式化
            formatChannel: function (val) {
                return this.channels.get(val)
            },
            // 多选勾选事件
            handleSelectionChange: function (val) {
                this.selectData = val;
            },
            // 点击‘详情/审核’事件
            openExamine: function (row) {
                var self = this;
                self.isExamine = row.status === 'APPLYING';
                self.examineDialogVisible = true;
                self.formData = row;
                // ‘申请’状态打开窗口获取提现方式
                if (self.isExamine) {
                    // 查询前置空提现方式集合
                    self.withdrawalMethod = [];

                    // 印度银行卡类型为UPI时提现方式为GLOBALPAY
                    if (row.type === 'UPI') {
                        self.withdrawalMethod = ['GLOBALPAY'];
                    }else {
                        $.post(base + "/platform/user/account/withdraw/getWithdrawalMethod", {bankLibId: self.formData.bankLibId}, function (data) {
                            if (data.code === 0) {
                                self.withdrawalMethod = data.data
                            } else {
                                self.$message({
                                    message: data.msg,
                                    type: 'error'
                                });
                            }
                        }, "json");
                    }
                }
            },
            // 点击复审事件
            openExamineReview: function (row) {
                var self = this;
                self.isExamineReview = row.status === 'PENDING_BANK';
                self.examineReviewDialogVisible = true;
                self.formData = row;
            },
            // 打开提现窗口事件
            openAdd: function () {
                var self = this;
                self.addDialogVisible = true;
                self.cardInputShow = true;
                self.formData = {};
                if (self.$refs["addForm"])
                    self.$refs["addForm"].resetFields();
            },
            // 提交‘提现’申请
            doAdd: function () {
                var self = this;
                var url = base + "/platform/user/account/withdraw/add";
                // 卡号没填就是系统扣款
                if (!self.formData.cardId) {
                    self.formData.channel = 'PLATFORM';
                }
                self.$refs["addForm"].validate(function (valid) {
                    if (valid) {//表单验证通过
                        $.post(url, self.formData, function (data) {
                            if (data.code == 0) {
                                self.$message({
                                    message: data.msg,
                                    type: 'success'
                                });
                                self.addDialogVisible = false;
                                self.pageData();
                            } else {
                                self.$message({
                                    message: data.msg,
                                    type: 'error'
                                });
                            }
                        }, "json");
                    }
                });
            },
            // 审核/复审通过按钮事件
            doExamine: function (command) {
                var self = this;
                if (command.opType === 'REVIEW'){
                    if (!self.formData.remark || self.formData.remark === 'undefined' || !/[^\s]/.test(self.formData.remark)) {
                        self.$message({
                            message: "复审必须填写备注",
                            type: 'error'
                        });
                        return;
                    }
                }
                command.remark = self.formData.remark;
                self.buttonDisabled = true;
                $.post(base + "/platform/user/account/withdraw/examine", command, function (data) {
                    if (data.code == 0) {
                        self.pageData();
                        self.$message({
                            type: 'success'
                        });
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                    self.examineDialogVisible = false;
                    self.examineReviewDialogVisible = false;
                    self.buttonDisabled = false;
                }, "json");
            },
            // 精确搜索用户
            getAccounts: function (str) {
                var _this = this;
                if (!_this.formData.currencyId) {
                    _this.$message({
                        message: "请选择币种",
                        type: 'error'
                    });
                    return false;
                }
                $.post(base + "/platform/user/manager/searchAccount", {
                    key: str,
                    currencyId: _this.formData.currencyId
                }, function (data) {
                    if (data.code == 0) {
                        _this.userOptions = data.data.map(ite => {
                            ite.label = ite.userName + '(真名:' + (ite.realName ? ite.realName : '未设置,') + '余额:' + ite.balance + ")";
                            return ite
                        })
                        ;
                    } else {
                    }
                }, "json");
            },
            // 选择用户input框改变事件
            onChange: function (val) {
                // 查询用户银行卡列表
                this.$set(this.formData, 'toUser', val);
                this.getCards();
            },
            // 选择币种input框改变事件
            currencyChange: function (val) {
                var _this = this;
                this.$set(this.formData, 'toUser', '');
                // 清空用户option
                _this.userOptions = [];
                var currency;
                for (const item of _this.currencies) {
                    if (item.id === val) {
                        currency = item;
                        break;
                    }
                }
                _this.cardInputShow = currency.cashEnable;
            },
            // 根据用户id币种id获取用户银行卡列表
            getCards: function () {
                var _this = this;
                if (!_this.formData.currencyId) {
                    _this.$message({
                        message: "请选择币种",
                        type: 'error'
                    });
                    return false;
                }
                $.post(base + "/platform/user/bankCard/list", {
                    currencyId: _this.formData.currencyId,
                    userId: _this.formData.toUser
                }, function (data) {
                    _this.cards = data.code == 0 ? data.data : [];
                }, "json");
            },
            // 币种列表
            getCurrencies: function () {
                var _this = this;
                $.post(base + "/platform/sys/currency/list", function (data) {
                    _this.currencies = data.data.map(ite => {
                        ite.name = ite.name + "(" + ite.rate + ")";
                        return ite;
                    })
                    ;
                    _this.currencies.push({
                        id: '',
                        name: '全部币种'
                    });
                }, "json");
            },
            // 提现状态枚举列表
            getStatus: function () {
                var _this = this;
                $.post(base + "/platform/user/account/withdraw/status", function (data) {
                    if (data.code == 0) {
                        _this.statusOptions = data.data;
                        _this.statusOptions.push({
                            id: '',
                            name: '全部状态'
                        });
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json")
            },
        },
        created: function () {
            this.pageData();
            this.getCurrencies();
            this.getStatus();
        }
    });
</script>
<!--#
}
#-->